@extends('admin')

@section('content')

    <p class="mb10">
        <a href="{{url('merchant/product/newj')}}" class="btn J_dialog" title="添加类别"><span class="add"></span>添加类别</a>
    </p>

    <div class="h_a">搜索</div>
    <div class="search_type cc mb10">
        <form action="{{url('merchant/product')}}" method="get" class="search_form">
            <label for="search_title">名称：</label>
            <input type="text" name="title" value="{{isset($appends['name']) ? $appends['name'] : ''}}" id="search_title" class="input length_2 mr10"/>
            <label for="search_title">一级分类：</label>
            <select name="parentcategory">
                <option value="">不限</option>
                @foreach($parent as $key=>$item)
                    <option value="{{$key}}" {{isset($appends['parentcategory']) && $key == $appends['parentcategory'] ? "selected='selected'" : ''}}>{{$item}}</option>
                @endforeach
            </select>
            <button type="submit" class="btn">搜索</button>
        </form>

    </div>

    <div class="table_list">
        <div id="data_list">
            <table class="items">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>名称</th>
                    <th>类别名称</th>
                    <th>发布人</th>
                    <th>一级分类</th>
                    <th>开工时间</th>
                    <th>结束时间</th>
                    <th>发布时间</th>
                    <th>取消时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($list as $item)
                    <tr>
                        <td>{{$item->jobid}}</td>
                        <td>{{$item->name}}</td>
                        <td>{{$item->category->name}}</td>
                        <td>{{$users[$item->userid]}}</td>
                        <td>{{0 == $item->parentcategory? $parent[$item->category->parentid] : $parent[$item->parentcategory]}}</td>
                        <td>{{$item->starttime}}</td>
                        <td>{{$item->endtime}}</td>
                        <td>{{$item->pubtime}}</td>
                        <td>{{$item->canceltime}}</td>
                        <td>{{$item->state}}</td>
                        <td>
                            <a href="{{url('merchant/product/newj/'.$item->jobid)}}" title="编辑 {{$item->name}}" class="mr10 J_dialog">[编辑]</a>
                            <a href="{{url('merchant/product/delj/'.$item->jobid)}}" title="删除 {{$item->name}}" class="mr10 J_dialog">[删除]</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="summary">
            共有 {{$list->total()}} 条数据
        </div>
        @if ($list->hasPages())
            <div class="pager">
                {!! $list->render() !!}
            </div>
        @endif
    </div>

@stop